/*
 * include/linux/mfd/cap1128.h -- Core interface for CAP1128
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 *
 */

#ifndef __CAP1128_H__
#define __CAP1128_H__

#define CAP1128_REG_MAIN_CTRL		0x00u
#define CAP1128_REG_BTN_STA			0x03u
#define CAP1128_REG_SENSOR_DELTA	0x10u
#define CAP1128_REG_INT_ENABLE		0x27u
#define CAP1128_REG_PID		0xFDu
#define CAP1128_REG_REV		0xFFu

#define CAP1128_REV			0x80u
#define CAP1128_PID			0x52u

struct cap1128_dev {
	struct mutex io_lock;

	struct device *dev;
	struct i2c_client *i2c_client;
	
	struct cap1128_ts *ts;

	int (*read_dev)(struct cap1128_dev *cap1128, u8 reg,
					int bytes, void *dest);
	int (*write_dev)(struct cap1128_dev *cap1128, u8 reg,
					int bytes, void *src);

	void (*irq_callback)(int irq, void *data);

	int irq;  /* Our chip IRQ */
};

struct cap1128_ts {
	int count;
	struct input_dev *input;
	struct delayed_work work;
	struct cap1128_dev *dev;
};

struct cap1128_pdata {
	void (*reset)(int val);
	u8 *init_data;
};

int cap1128_read(struct cap1128_dev *cap1128, u8 reg);
int cap1128_bulk_read(struct cap1128_dev *cap1128, u8 reg, int count, u8 *buf);
int cap1128_write(struct cap1128_dev *cap1128, u8 reg, u8 val);
int cap1128_bulk_write(struct cap1128_dev *cap1128, u8 reg, int count, u8 *buf);
int cap1128_write_bits(struct cap1128_dev *cap1128, u8 reg, u8 mask, u8 val);

#endif	// end __CAP1128_H__
